﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using mBook.Entity;

namespace mBook.DataAccess
{
    public class DDWeekTopDA
    {
        public void DDWeekTopInsert(IList<ddWeekTop> weekTopSet)
        {
            using (mBookEntityContextWrapper context = new mBookEntityContextWrapper())
            {
                context.ddWeekTops.InsertAllOnSubmit(weekTopSet);
                context.SubmitChanges();
            }
        }

        public void DDWeekTopInsert()
        {
            using (mBookEntityContextWrapper context = new mBookEntityContextWrapper())
            {
                List<ddWeekTop> list = context.ddWeekTops.ToList();
                context.ddWeekTops.DeleteAllOnSubmit(list);
                context.SubmitChanges();
            }
        }

        public IList<ddWeekTop> GetAll()
        {
            IList<ddWeekTop> result;
            using (mBookEntityContextWrapper context = new mBookEntityContextWrapper())
            {
                result = context.ddWeekTops.ToList();
            }
            return result;
        }
    }
}
